package cn.jiyun;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/*@EnableDiscoveryClient  //开启注册中心客户端功能  注册中心可以是eureka也可以是nacos等其他注册中心
@SpringBootApplication
@EnableCircuitBreaker //开启服务熔断和服务降级功能*/
@SpringCloudApplication
@EnableFeignClients //开启feign远程调用功能
public class ConsumerApplication {

    @Bean
    @LoadBalanced  //开启ribbon负载均衡调用
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }
}
